/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.f1x.api.message.fields;

// Generated by org.f1x.tools.DictionaryGenerator from QuickFIX dictionary
public enum OrdType implements org.f1x.api.message.types.ByteEnum {
	MARKET((byte)'1'),
	LIMIT((byte)'2'),
	STOP((byte)'3'),
	STOP_LIMIT((byte)'4'),
	MARKET_ON_CLOSE((byte)'5'),
	WITH_OR_WITHOUT((byte)'6'),
	LIMIT_OR_BETTER((byte)'7'),
	LIMIT_WITH_OR_WITHOUT((byte)'8'),
	ON_BASIS((byte)'9'),
	ON_CLOSE((byte)'A'),
	LIMIT_ON_CLOSE((byte)'B'),
	FOREX_MARKET((byte)'C'),
	PREVIOUSLY_QUOTED((byte)'D'),
	PREVIOUSLY_INDICATED((byte)'E'),
	FOREX_LIMIT((byte)'F'),
	FOREX_SWAP((byte)'G'),
	FOREX_PREVIOUSLY_QUOTED((byte)'H'),
	FUNARI((byte)'I'),
	MARKET_IF_TOUCHED((byte)'J'),
	MARKET_WITH_LEFTOVER_AS_LIMIT((byte)'K'),
	PREVIOUS_FUND_VALUATION_POINT((byte)'L'),
	NEXT_FUND_VALUATION_POINT((byte)'M'),
	PEGGED((byte)'P');

	private final byte code;

	OrdType (byte code) {
		this.code  = code;
	}

	public byte getCode() { return code; }

	public static OrdType parse(String s) {
		switch(s) {
			case "1" : return MARKET;
			case "2" : return LIMIT;
			case "3" : return STOP;
			case "4" : return STOP_LIMIT;
			case "5" : return MARKET_ON_CLOSE;
			case "6" : return WITH_OR_WITHOUT;
			case "7" : return LIMIT_OR_BETTER;
			case "8" : return LIMIT_WITH_OR_WITHOUT;
			case "9" : return ON_BASIS;
			case "A" : return ON_CLOSE;
			case "B" : return LIMIT_ON_CLOSE;
			case "C" : return FOREX_MARKET;
			case "D" : return PREVIOUSLY_QUOTED;
			case "E" : return PREVIOUSLY_INDICATED;
			case "F" : return FOREX_LIMIT;
			case "G" : return FOREX_SWAP;
			case "H" : return FOREX_PREVIOUSLY_QUOTED;
			case "I" : return FUNARI;
			case "J" : return MARKET_IF_TOUCHED;
			case "K" : return MARKET_WITH_LEFTOVER_AS_LIMIT;
			case "L" : return PREVIOUS_FUND_VALUATION_POINT;
			case "M" : return NEXT_FUND_VALUATION_POINT;
			case "P" : return PEGGED;
		}
		return null;
	}

}